﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MuaChung.Models.CouponDetailMin>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Danh sách coupon
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <link href="/Content/ListCoupon.css" rel="stylesheet" type="text/css" />
    <h2>
        Danh sách coupon</h2>
    <%if (ViewData["status"].ToString() == "NoItem")
      {%>
          Hiện không có coupon nào đang được bán.<br />
          Mong quý khách thông cảm và vui lòng quay lại sau.
      <%}
      else
      {%>    
    <div id="MainLeft">
        <div style="float:left;margin-top:20px;margin-left:30px">
            <script type="text/javascript">
                function OrderTypeChange() {                    
                    if ($("#selectOrderType").val() == "thoiGian") {
                        window.location = "/Coupon/ListAllCoupon?currentPage=1&orderType=1";
                    }
                    else {
                        window.location = "/Coupon/ListAllCoupon?currentPage=1&orderType=2";
                    }
                }
            </script>
            <%string t = ViewData["ot"].ToString(); %>
            Xem coupon theo:
            <select name="selectOrderType" id="selectOrderType" onchange="OrderTypeChange()">
                <%if (t == "1")
                  {%>
                    <option value="thoiGian" selected="selected">Mới nhất</option>
                    <option value="nhieuNhat">Nhiều người đặt nhất</option> 
                <%}
                  else
                  {%>
                    <option value="thoiGian">Mới nhất</option>
                    <option value="nhieuNhat" selected="selected">Nhiều người đặt nhất</option>
                <%} %>                
            </select>
        </div>
        <div id="PagingContent1" class="PagingContent">
            <%string i = ViewData["cp"].ToString();
              string s = ViewData["ps"].ToString(); %>
            <script type="text/javascript">
                GetContent("/Share/Paging?type=allCoupon&currentPage=<%:i %>&pageSize=<%: s %>", "PagingContent1");
            </script>
        </div>
        <div id="DisplayList">
            <ul class="ul_listBestPrice">
                <%foreach (var item in Model)
                  {%>
                <li class="li_ListBP">
                    <div class="div_topListBP">
                    </div>
                    <div class="div_bodyListBP">
                        <div class="div_bodyLineRound">
                        </div>
                        <div class="div_infoListBP">
                            <div class="div_LBodyListBP">
                                <div class="div_TietKiem">
                                    <strong class="styleText14">Tiết Kiệm</strong><br>
                                    <strong class="styleText15">
                                        <%:(int)item.tyLeGiam %>%</strong></div>
                                <div class="divPrice">
                                    <span class="styleText17">Giá trị:<strong class="StyleTextGT lineHorizontal styleText13"><%: (int)item.giaGoc %></strong></span><div
                                        class="div_VND GTVND">
                                        <strong class="styleText16">VND</strong></div>
                                    <br>
                                    <span class="styleText17 spTietKiem">Tiết kiệm:<strong class="StyleTextGT styleText13"><%: (int)(item.giaGoc - item.giaTot)%></strong></span><div
                                        class="div_VND TKVND">
                                        <strong class="styleText16">VND</strong></div>
                                </div>
                                <div class="div_infoMoney">
                                    <div class="div_TextInfoMoney">
                                        <p class="styleText14">
                                            <strong>Còn Lại</strong><strong class="strTextVND">VND</strong></p>
                                        <p class="pGiaTien">
                                            <strong class="styleText5">
                                                <%: (int)item.giaTot %></strong></p>
                                    </div>
                                </div>
                                <p class="color9 styleText9 pWasBuyer">
                                    <strong>
                                        <%: item.soLuongDatHang %></strong></p>
                                <p class="pWasBuyer color9 styleText14">
                                    Người mua giá tốt</p>
                            </div>
                            <div class="div_RBodyListBP">
                                <p class="pTextInfoList styleText8">
                                    <a title="<%: item.tenSP %> Giảm <%: (int)item.tyLeGiam %>%."
                                        href="/Coupon/CouponDetail?cid=<%: item.cid %>">
                                        <%: item.tenSP %>                                        
                                        &ndash; Giảm
                                        <%: (int)item.tyLeGiam %>%.</a></p>
                                <div class="div_imgListBP">
                                    <a href="/Coupon/CouponDetail?cid=<%: item.cid %>">
                                        <%if (item.trangThai == "ChayHang")
                                          {%>
                                        <i class="iChayHang"></i>
                                        <%} %>
                                        <img width="229" height="140" src="<%: item.hinhAnh%>" alt="<%: item.tenSP %>"></a></div>
                                <p class="styleText13 pDayCity">
                                    TP Hồ Chí Minh -
                                    <%: item.tgBatDau.ToShortDateString() %></p>
                            </div>
                        </div>
                    </div>
                    <div class="div_bottomListBP">
                    </div>
                </li>
                <%} %>
            </ul>
        </div>
        <div id="PagingContent2" class="PagingContent" style="clear:both">            
            <script type="text/javascript">
                GetContent("/Share/Paging?type=allCoupon&currentPage=<%:i %>&pageSize=<%: s %>", "PagingContent2");
            </script>
        </div>
    </div>
    <%}%>
</asp:Content>